package com.hbut.day01;

/**
 * @author PJM
 * @date 2025/6/21-11:11
 */
public class Person {
    /**
     * 人物名称
     */
    private String name;
    /**
     * 血量
     */
    private int blood;

    /**
     * 防御值
     */
    private int defense;

    /**
     * 攻击值
     */
    private int attack;

    public int getMagic() {
        return magic;
    }

    public void setMagic(int magic) {
        this.magic = magic>0?magic:0;
    }

    /**
     * 蓝量
     */
    private int magic;


    private Skill[] skills = null;

    public Skill[] getSkills() {
        return skills;
    }

    public void setSkills(Skill[] skills) {
        this.skills = skills;
    }

    public Person(String name, int blood, int defense, int attack, int magic){
        this.name = name;
        this.blood = blood;
        this.defense = defense;
        this.attack = attack;
        this.magic = magic;
    }

    public void acceptAttack(int hurt){
        if (hurt>0){
            this.blood = this.blood-hurt>0?this.blood-hurt:0;
        }
    }

    public String getName() {
        return name;
    }

    public int getBlood() {
        return blood;
    }

    public int getDefense() {
        return defense;
    }

    public int getAttack() {
        return attack;
    }
}
